package buildcode.shop;

import java.util.Optional;

import buildcode.database.TableColumnInfo;
import buildcode.language.MetaDataField;
import buildcode.language.Type;
import buildcode.language.es.type.EsType;

public class VueField extends MetaDataField<Type, TableColumnInfo> {
    private String frameType;

    public VueField(String fieldName, String typeName, String packagePath, TableColumnInfo metaData) {
        super(fieldName, typeName, metaData);
        setType(new EsType(typeName, packagePath));
    }

    public String getFrameType() {
        return frameType;
    }

    public void setFrameType(String frameType) {
        this.frameType = frameType;
    }

    public String getLabel() {
        return Optional.ofNullable(getRemark()).map(v -> v.trim().split("\\s+|[:,]")).map(v -> v[0]).orElse("");
    }

}
